package com.example.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.entity.dto.GongZhuangSelectDto;
import com.example.entity.vo.GongZhuangVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@DS("mes")
public interface GongZhuangMapper extends BaseMapper<GongZhuangVo> {

    List<GongZhuangVo> list(@Param("dto") GongZhuangSelectDto dto);

    @Select("SELECT count(*) from resourcegroup where resourceGroupNO = #{deviceId}")
    Long noNumber(String deviceId);

    @Update("UPDATE resourcegroup \n" +
            "SET resourceGroupNO = #{deviceId}, resourceGroupName = #{deviceName}\n" +
            "WHERE resourceGroupId = #{id};")
    void updateGroup(String id,String deviceId, String deviceName);

}
